<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js">&lt;?php
<span id='global-property-'>/**
</span> * Cube PHP Framework
 * 
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the &quot;License&quot;); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 * 
 * @author Dillen / Steffen
 */

namespace Library\Mvc\View;

use Library\IO\Exception\FileNotFoundException;

<span id='Library-Mvc-View-Wrapper'>/**
</span> * View wrapper
 * 
 * @class Library.Mvc.View.Wrapper
 */
class Wrapper
{
	protected $modulePath;
		
<span id='Library-Mvc-View-Wrapper-method-load'>	/**
</span>	 * Load view
	 * 
	 * @method load
	 * @param {String} $view View source file
	 * @param {String} $modulePath Path to the module
	 * @param {Array} $vars
	 * @return {String} Output string
	 */
	public function load($view, $modulePath, $vars)
	{
		$this-&gt;modulePath = $modulePath;
		
		$path = $this-&gt;modulePath . '/' . $view . '.phtml';
		
		if (!file_exists($path))
		{
			throw new FileNotFoundException($path);
		}
		
		extract($vars);
		
		ob_start();
		
		include $path;
		
		$output = ob_get_contents();
		ob_end_clean();
		
		return $output;
	}
	
<span id='Library-Mvc-View-Wrapper-method-extend'>	/**
</span>	 * Extend view
	 * 
	 * @method extend
	 * @param {String} $view
	 * @param {Array} $vars
	 */
	public function extend($view, $vars)
	{
		echo $this-&gt;load('views/' . $view, $this-&gt;modulePath, $vars);
	}
}
</pre>
</body>
</html>
